export default {
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      vm.tableSizeChange && vm.tableSizeChange();
      vm.beforeRouteEnter(vm);
    });
  },
  beforeRouteLeave(to, from, next) {
    this.beforeRouteLeave();
    next();
  },
  methods: {
    beforeRouteEnter(vm) {
      vm.tableSizeChange &&
        window.addEventListener("resize", this.tableSizeChange);
    },
    beforeRouteLeave() {
      this.tableSizeChange &&
        window.removeEventListener("resize", this.tableSizeChange);
    },
  },
};
